import request from '@/untils/request'
import type { distLvType, hosByName } from '@/api/hospital/type'

enum API {
  GET_PAGE_LIST = '/hosp/hospital/',
  // 获取等级和地区
  GET_DIST_LEVEL = '/cmn/dict/findByDictCode/',
  // 根据名字获取医院
  GET_HOS_BY_NAME = '/hosp/hospital/findByHosname/'
}

export const getPageList = (page: number, limit: number, hostype = '', districtCode = '') =>
  request.get<any, any>(
    API.GET_PAGE_LIST + `${page}/${limit}?hostype=${hostype}&districtCode=${districtCode}`
  )

export const getDistLv = (dictCode: string) =>
  request.get<any, distLvType>(API.GET_DIST_LEVEL + dictCode)

export const getHosByName = (hosname:string) => 
    request.get<any, hosByName>(API.GET_HOS_BY_NAME + hosname)
